home *** CD-ROM | disk | FTP | other *** search
/ PC World Interactive 1 / PC World Interactive 1 - Nisan 1997.iso / nostalji / bbs / music / sbbook.arj / SBBOOK / SOURCE / SBSIMDMO / GRAPH.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-22  |  27.3 KB  |  630 lines

  1. #include <alloc.h>
  2. #include <conio.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5. #include "filefunc.h"
  6. #include "graph.h"
  7. #include "drvrfunc.h"
  8.  
  9. int mixer;
  10. char *statStr[] = {"missing", "loaded"};
  11. char *memErr = "Unable to allocate memory for background save.";
  12.  
  13. //--------------------------------------------------------------------------
  14. //                                                screen data definitions
  15. //--------------------------------------------------------------------------
  16. char slider[4] = {'▒',0x10,'█',0x1f};
  17. char errBoxLine[] = {'═',0x4f};
  18. char errBoxSpace[] = {' ',0x4f};
  19. char errBoxLeft[] = {'╔',0x4f,'═',0x4f,'═',0x4f,'║',0x4f,' ',0x4f,' ',0x4f,
  20.                                          '║',0x4f,' ',0x4f,' ',0x4f,'║',0x4f,' ',0x4f,' ',0x4f,
  21.                                          '╚',0x4f,'═',0x4f,'═',0x4f};
  22.  
  23. char errBoxRight[] = {'═',0x4f,'═',0x4f,'╗',0x4f,' ',0x4f,' ',0x4f,'║',0x4f,
  24.                                             ' ',0x4f,' ',0x4f,'║',0x4f,' ',0x4f,' ',0x4f,'║',0x4f,
  25.                                             '═',0x4f,'═',0x4f,'╝',0x4f};
  26.  
  27. char infoBoxTop[] = {'╔',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  28.                                          '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  29.                                          '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  30.                                          '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  31.                                          '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  32.                                          '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  33.                                          '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  34.                                          '═',0x1f,'═',0x1f,'╗',0x1f,'║',0x1f,' ',0x1f,'S',0x1f,
  35.                                          'B',0x1f,'S',0x1f,'I',0x1f,'M',0x1f,',',0x1f,' ',0x1f,
  36.                                          'V',0x1f,'e',0x1f,'r',0x1f,'s',0x1f,'i',0x1f,'o',0x1f,
  37.                                          'n',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  38.                                          ',',0x1f,' ',0x1f,' ',0x1f,'U',0x1f,'s',0x1f,'i',0x1f,
  39.                                          'n',0x1f,'g',0x1f,' ',0x1f,'i',0x1f,'n',0x1f,'t',0x1f,
  40.                                          'e',0x1f,'r',0x1f,'r',0x1f,'u',0x1f,'p',0x1f,'t',0x1f,
  41.                                          ' ',0x1f,' ',0x1f,' ',0x1f,'h',0x1f,' ',0x1f,'║',0x1f};
  42.  
  43. char infoBox[] = {'╟',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,
  44.                                     '─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,
  45.                                     '─',0x1f,'┬',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,
  46.                                     '─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,
  47.                                     '─',0x1f,'─',0x1f,'┬',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,
  48.                                     '─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,
  49.                                     '─',0x1f,'┬',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,
  50.                                     '─',0x1f,'─',0x1f,'╨',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,
  51.                                     '┬',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,
  52.                                     '─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,
  53.                                     '┬',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,
  54.                                     '─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'╖',0x1f,
  55.                                     '║',0x1f,' ',0x1f,'N',0x1f,'a',0x1f,'m',0x1f,'e',0x1f,
  56.                                     '.',0x1f,'.',0x1f,'.',0x1f,'.',0x1f,'.',0x1f,'.',0x1f,
  57.                                     '.',0x1f,'│',0x1f,'C',0x1f,'T',0x1f,'-',0x1f,'V',0x1f,
  58.                                     'O',0x1f,'I',0x1f,'C',0x1f,'E',0x1f,'.',0x1f,'D',0x1f,
  59.                                     'R',0x1f,'V',0x1f,'│',0x1f,'C',0x1f,'T',0x1f,'V',0x1f,
  60.                                     'D',0x1f,'S',0x1f,'K',0x1f,'.',0x1f,'D',0x1f,'R',0x1f,
  61.                                     'V',0x1f,'│',0x1f,'A',0x1f,'U',0x1f,'X',0x1f,'D',0x1f,
  62.                                     'R',0x1f,'V',0x1f,'.',0x1f,'D',0x1f,'R',0x1f,'V',0x1f,
  63.                                     '│',0x1f,'S',0x1f,'B',0x1f,'F',0x1f,'M',0x1f,'D',0x1f,
  64.                                     'R',0x1f,'V',0x1f,'.',0x1f,'C',0x1f,'O',0x1f,'M',0x1f,
  65.                                     '│',0x1f,'S',0x1f,'B',0x1f,'M',0x1f,'I',0x1f,'D',0x1f,
  66.                                     'I',0x1f,'.',0x1f,'E',0x1f,'X',0x1f,'E',0x1f,'║',0x1f,
  67.                                     '║',0x1f,' ',0x1f,'S',0x1f,'t',0x1f,'a',0x1f,'t',0x1f,
  68.                                     'u',0x1f,'s',0x1f,'.',0x1f,'.',0x1f,'.',0x1f,'.',0x1f,
  69.                                     '.',0x1f,'│',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  70.                                     ' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  71.                                     ' ',0x1f,' ',0x1f,'│',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  72.                                     ' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  73.                                     ' ',0x1f,'│',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  74.                                     ' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  75.                                     '│',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  76.                                     ' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  77.                                     '│',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  78.                                     ' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,'║',0x1f,
  79.                                     '║',0x1f,' ',0x1f,'E',0x1f,'n',0x1f,'t',0x1f,'r',0x1f,
  80.                                     'y',0x1f,' ',0x1f,'p',0x1f,'o',0x1f,'i',0x1f,'n',0x1f,
  81.                                     't',0x1f,'│',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  82.                                     ' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  83.                                     ' ',0x1f,' ',0x1f,'│',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  84.                                     ' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  85.                                     ' ',0x1f,'│',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  86.                                     ' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  87.                                     '│',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  88.                                     ' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  89.                                     '│',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  90.                                     ' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,'║',0x1f,
  91.                                     '║',0x1f,' ',0x1f,'B',0x1f,'u',0x1f,'f',0x1f,'f',0x1f,
  92.                                     'e',0x1f,'r',0x1f,' ',0x1f,'l',0x1f,'o',0x1f,'c',0x1f,
  93.                                     '.',0x1f,'│',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  94.                                     ' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  95.                                     ' ',0x1f,' ',0x1f,'│',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  96.                                     ' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  97.                                     ' ',0x1f,'│',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  98.                                     ' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  99.                                     '│',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  100.                                     ' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  101.                                     '│',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  102.                                     ' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,'║',0x1f,
  103.                                     '║',0x1f,' ',0x1f,'B',0x1f,'u',0x1f,'f',0x1f,'f',0x1f,
  104.                                     'e',0x1f,'r',0x1f,' ',0x1f,'S',0x1f,'i',0x1f,'z',0x1f,
  105.                                     'e',0x1f,'│',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  106.                                     ' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  107.                                     ' ',0x1f,' ',0x1f,'│',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  108.                                     ' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  109.                                     ' ',0x1f,'│',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  110.                                     ' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  111.                                     '│',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  112.                                     ' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  113.                                     '│',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,
  114.                                     ' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,'║',0x1f,
  115.                                     '╚',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  116.                                     '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  117.                                     '═',0x1f,'╧',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  118.                                     '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  119.                                     '═',0x1f,'═',0x1f,'╧',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  120.                                     '[',0x1f,'H',0x1f,'i',0x1f,'t',0x1f,' ',0x1f,'A',0x1f,
  121.                                     'n',0x1f,'y',0x1f,' ',0x1f,'K',0x1f,'e',0x1f,'y',0x1f,
  122.                                     ']',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  123.                                     '╧',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  124.                                     '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  125.                                     '╧',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  126.                                     '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'╝',0x1f};
  127.  
  128. char title[] = {'╔',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  129.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  130.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  131.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  132.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  133.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  134.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  135.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  136.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  137.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  138.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  139.                                 '═',0x1f,'═',0x1f,'╗',0x1f,'║',0x1f,' ',0x1e,' ',0x1e,' ',0x1e,
  140.                                 'S',0x1e,'o',0x1e,'u',0x1e,'n',0x1e,'d',0x1e,' ',0x1e,'B',0x1e,
  141.                                 'l',0x1e,'a',0x1e,'s',0x1e,'t',0x1e,'e',0x1e,'r',0x1e,' ',0x1e,
  142.                                 'S',0x1e,'i',0x1e,'m',0x1e,'p',0x1e,'l',0x1e,'i',0x1e,'f',0x1e,
  143.                                 'i',0x1e,'e',0x1e,'d',0x1e,' ',0x1e,'I',0x1e,'n',0x1e,'t',0x1e,
  144.                                 'e',0x1e,'r',0x1e,'f',0x1e,'a',0x1e,'c',0x1e,'e',0x1e,' ',0x1e,
  145.                                 'M',0x1e,'o',0x1e,'d',0x1e,'u',0x1e,'l',0x1e,'e',0x1e,' ',0x1e,
  146.                                 '(',0x1e,'S',0x1e,'B',0x1e,'S',0x1e,'I',0x1e,'M',0x1e,')',0x1e,
  147.                                 ' ',0x1e,'D',0x1e,'e',0x1e,'m',0x1e,'o',0x1e,'n',0x1e,'s',0x1e,
  148.                                 't',0x1e,'r',0x1e,'a',0x1e,'t',0x1e,'i',0x1e,'o',0x1e,'n',0x1e,
  149.                                 ' ',0x1e,'P',0x1e,'r',0x1e,'o',0x1e,'g',0x1e,'r',0x1e,'a',0x1e,
  150.                                 'm',0x1e,' ',0x1e,' ',0x1e,' ',0x1e,' ',0x1e,'║',0x1f,'╚',0x1f,
  151.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  152.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  153.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  154.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  155.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  156.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  157.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  158.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  159.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  160.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  161.                                 '═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,
  162.                                 '═',0x1f,'╝',0x1f};
  163.  
  164. char backgnd[] = {'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,
  165.                                     '▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,
  166.                                     '▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,
  167.                                     '▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,
  168.                                     '▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,
  169.                                     '▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,
  170.                                     '▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,
  171.                                     '▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,
  172.                                     '▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,
  173.                                     '▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,
  174.                                     '▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,'▒',0x17,
  175.                                     '▒',0x17,'▒',0x17,'▒',0x17};
  176.  
  177. char menu[] = {' ',0x70,'E',0x70,'S',0x70,'C',0x70,' ',0x70,'-',0x70,' ',0x70,
  178.                              'e',0x70,'x',0x70,'i',0x70,'t',0x70,'│',0x70,'T',0x70,'A',0x70,
  179.                              'B',0x70,' ',0x70,'-',0x70,' ',0x70,'c',0x70,'h',0x70,'g',0x70,
  180.                              '.',0x70,' ',0x70,'w',0x70,'i',0x70,'n',0x70,'d',0x70,'o',0x70,
  181.                              'w',0x70,'│',0x70,'',0x70,'─',0x70,'┘',0x70,' ',0x70,'-',0x70,
  182.                              ' ',0x70,'S',0x70,'t',0x70,'a',0x70,'r',0x70,'t',0x70,'/',0x70,
  183.                              'S',0x70,'t',0x70,'o',0x70,'p',0x70,'│',0x70,'S',0x70,'p',0x70,
  184.                              'a',0x70,'c',0x70,'e',0x70,' ',0x70,'-',0x70,' ',0x70,'P',0x70,
  185.                              'a',0x70,'u',0x70,'s',0x70,'e',0x70,'/',0x70,'C',0x70,'o',0x70,
  186.                              'n',0x70,'t',0x70,'│',0x70,'F',0x70,'1',0x70,' ',0x70,'-',0x70,
  187.                              ' ',0x70,'D',0x70,'v',0x70,'r',0x70,' ',0x70,'I',0x70,'n',0x70,
  188.                              'f',0x70,'o',0x70,' ',0x70};
  189.  
  190. char hwintop[] = {'╔',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f
  191.                                  ,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f
  192.                                  ,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f
  193.                                  ,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f
  194.                                  ,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'╗',0x1f};
  195.  
  196. char hwinmid[] = {'║',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f
  197.                                  ,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f
  198.                                  ,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f
  199.                                  ,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f
  200.                                  ,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,' ',0x1f,'║',0x1f};
  201.  
  202. char hwinlin[] = {'╟',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f
  203.                                  ,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f
  204.                                  ,' ',0x1f,'V',0x1f,'o',0x1f,'l',0x1f,'u',0x1f,'m',0x1f,'e',0x1f
  205.                                  ,' ',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f
  206.                                  ,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'─',0x1f,'╢',0x1f};
  207.  
  208. char hwinvol[] = {'║',0x1f,' ',0x1f,'═',0x12,'═',0x12,'═',0x12,'═',0x12,'═',0x12
  209.                                  ,'═',0x12,'═',0x12,'═',0x12,'═',0x12,'═',0x12,'═',0x1a,'═',0x1a
  210.                                  ,'═',0x1a,'═',0x1a,'═',0x1a,'═',0x1a,'═',0x1a,'═',0x1a,'═',0x1e
  211.                                  ,'═',0x1e,'═',0x1e,'═',0x1e,'═',0x1e,'═',0x1e,'═',0x1e,'═',0x1c
  212.                                  ,'═',0x1c,'═',0x1c,'═',0x14,'═',0x14,' ',0x1f,'║',0x1f};
  213.  
  214. char hwinbot[] = {'╚',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f
  215.                                  ,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f
  216.                                  ,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f
  217.                                  ,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f
  218.                  ,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'═',0x1f,'╝',0x1f};
  219.  
  220. char wintop[] = {'╔',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10
  221.                                 ,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10
  222.                                 ,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10
  223.                                 ,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10
  224.                                 ,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'╗',0x10};
  225.  
  226. char winmid[] = {'║',0x10,' ',0x10,' ',0x10,' ',0x10,' ',0x10,' ',0x10,' ',0x10
  227.                                 ,' ',0x10,' ',0x10,' ',0x10,' ',0x10,' ',0x10,' ',0x10,' ',0x10
  228.                                 ,' ',0x10,' ',0x10,' ',0x10,' ',0x10,' ',0x10,' ',0x10,' ',0x10
  229.                                 ,' ',0x10,' ',0x10,' ',0x10,' ',0x10,' ',0x10,' ',0x10,' ',0x10
  230.                                 ,' ',0x10,' ',0x10,' ',0x10,' ',0x10,' ',0x10,'║',0x10};
  231.  
  232. char winlin[] = {'╟',0x10,'─',0x10,'─',0x10,'─',0x10,'─',0x10,'─',0x10,'─',0x10
  233.                                 ,'─',0x10,'─',0x10,'─',0x10,'─',0x10,'─',0x10,'─',0x10,'─',0x10
  234.                                 ,' ',0x10,'V',0x10,'o',0x10,'l',0x10,'u',0x10,'m',0x10,'e',0x10
  235.                                 ,' ',0x10,'─',0x10,'─',0x10,'─',0x10,'─',0x10,'─',0x10,'─',0x10
  236.                                 ,'─',0x10,'─',0x10,'─',0x10,'─',0x10,'─',0x10,'╢',0x10};
  237.  
  238. char winvol[] = {'║',0x10,' ',0x10,'═',0x12,'═',0x12,'═',0x12,'═',0x12,'═',0x12
  239.                                 ,'═',0x12,'═',0x12,'═',0x12,'═',0x12,'═',0x12,'═',0x1a,'═',0x1a
  240.                                 ,'═',0x1a,'═',0x1a,'═',0x1a,'═',0x1a,'═',0x1a,'═',0x1a,'═',0x1e
  241.                                 ,'═',0x1e,'═',0x1e,'═',0x1e,'═',0x1e,'═',0x1e,'═',0x1e,'═',0x1c
  242.                                 ,'═',0x1c,'═',0x1c,'═',0x14,'═',0x14,' ',0x10,'║',0x10};
  243.  
  244. char winbot[] = {'╚',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10
  245.                                 ,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10
  246.                                 ,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10
  247.                                 ,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10
  248.                 ,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'═',0x10,'╝',0x10};
  249.  
  250. char shadow[] = {'░',0x01,'░',0x01,'░',0x01,'░',0x01,'░',0x01,'░',0x01,'░',0x01
  251.                                 ,'░',0x01,'░',0x01,'░',0x01,'░',0x01,'░',0x01,'░',0x01,'░',0x01
  252.                                 ,'░',0x01,'░',0x01,'░',0x01,'░',0x01,'░',0x01,'░',0x01,'░',0x01
  253.                                 ,'░',0x01,'░',0x01,'░',0x01,'░',0x01,'░',0x01,'░',0x01,'░',0x01
  254.                                 ,'░',0x01,'░',0x01,'░',0x01,'░',0x01,'░',0x01,'░',0x01,'░',0x01
  255.                                 ,'░',0x01,'░',0x01};
  256.  
  257. //--------------------------------------------------------------------------
  258. //                                                     function definitions
  259. //--------------------------------------------------------------------------
  260.  
  261. /**************************************************************************
  262.  * FUNCTION: DRAWBACKGROUND - Draws the background pattern in the requested
  263.  *                            rectangle.
  264.  *
  265.  * Inputs: x1 - Left side.
  266.  *         y1 - Top.
  267.  *         x2 - Right side.
  268.  *         y2 - Bottom.
  269.  *
  270.  * Output: none
  271.  **************************************************************************/
  272. void DrawBackground(int x1, int y1, int x2, int y2)
  273. {
  274.     int i;
  275.  
  276.     if((x2 - x1) <= (y2 - y1))
  277.         for(i = y1; i <= y2; i++)
  278.             puttext(x1, i, x2, i, backgnd);
  279.     else
  280.         for(i = x1; i <= x2; i++)
  281.             puttext(i, y1, i, y2, backgnd);
  282. }
  283.  
  284. /*************************************************************************
  285.  * FUNCTION: DRAWWINDOW - draws the windows which display the digital
  286.  *                                                voice and music files.
  287.  *
  288.  * Inputs: *win - pointer to window structure
  289.  *                 state - state to draw window in (NORMAL or HIGHLIGHT).
  290.  *
  291.  * Output: none
  292.  *************************************************************************/
  293. void DrawWindow(WINDOW *win, int state)
  294. {
  295.     int i;
  296.     COORD loc;
  297.  
  298.     loc.x = (state == HIGHLIGHT)? win->loc.x - 2 : win->loc.x;
  299.     loc.y = (state == HIGHLIGHT)? win->loc.y - 1 : win->loc.y;
  300.  
  301.     if(state == HIGHLIGHT)
  302.     {
  303.         puttext(loc.x + win->size.x + 1, loc.y + 1,
  304.                         loc.x + win->size.x + 2, loc.y + win->size.y,
  305.                         shadow);
  306.         puttext(loc.x + 2, loc.y + win->size.y + 1,
  307.                         loc.x + win->size.x + 2, loc.y + win->size.y + 1,
  308.                         shadow);
  309.     }
  310.     else
  311.     {
  312.         DrawBackground(loc.x - 2, loc.y - 1,
  313.                                      loc.x - 1, loc.y + win->size.y - 1);
  314.         DrawBackground(loc.x, loc.y - 1,
  315.                                      loc.x + win->size.x - 2, loc.y - 1);
  316.     }
  317.  
  318.     puttext(loc.x, loc.y, loc.x + win->size.x, loc.y,
  319.                     (state == HIGHLIGHT)? hwintop : wintop);
  320.     for(i = 1; i < 14; i++)
  321.         puttext(loc.x, loc.y + i,
  322.                         loc.x + win->size.x, loc.y + i,
  323.                         (state == HIGHLIGHT)? hwinmid : winmid);
  324.     if(mixer == ON)
  325.     {
  326.         puttext(loc.x, loc.y + win->size.y - 2,
  327.                         loc.x + win->size.x, loc.y + win->size.y - 2,
  328.                         (state == HIGHLIGHT)? hwinlin : winlin);
  329.         puttext(loc.x, loc.y + win->size.y - 1,
  330.                         loc.x + win->size.x, loc.y + win->size.y - 1,
  331.                         (state == HIGHLIGHT)? hwinvol : winvol);
  332.     }
  333.     else
  334.     {
  335.         puttext(loc.x, loc.y + win->size.y - 2,
  336.                         loc.x + win->size.x, loc.y + win->size.y - 2,
  337.                         (state == HIGHLIGHT)? hwinmid : winmid);
  338.         puttext(loc.x, loc.y + win->size.y - 1,
  339.                         loc.x + win->size.x, loc.y + win->size.y - 1,
  340.                         (state == HIGHLIGHT)? hwinmid : winmid);
  341.     }
  342.  
  343.     puttext(loc.x, loc.y + win->size.y,
  344.                     loc.x + win->size.x, loc.y + win->size.y,
  345.                     (state == HIGHLIGHT)? hwinbot : winbot);
  346.  
  347.     textcolor((state == HIGHLIGHT)? WHITE : BLACK);
  348.     textbackground(BLUE);
  349.  
  350.     gotoxy(loc.x + win->size.x, loc.y + 1);
  351.     putch('');
  352.     gotoxy(loc.x + win->size.x, loc.y + win->size.y - ((mixer == ON)? 3 : 1));
  353.     putch('');
  354.  
  355.     gotoxy(loc.x + 1 + ((win->size.x - strlen(win->title)) >> 1), loc.y);
  356.     cputs(win->title);
  357.  
  358.     if(mixer == ON)
  359.     {
  360.     gotoxy(loc.x + 3, loc.y + win->size.y);
  361.     cputs(" « ");
  362.     gotoxy(loc.x + win->size.x - 5, loc.y + win->size.y);
  363.     cputs(" » ");
  364.  
  365.         DrawSlider(win, win->mixLvl, state);
  366.   }
  367.     DrawFileList(win, state);
  368. }
  369.  
  370. /*************************************************************************
  371.  * FUNCTION: INITSCREEN - intializes the screen by turning off the cursor,
  372.  *                                                drawing the title, drawing the desktop, and
  373.  *                                                drawing the keyboard options across the bottom.
  374.  *
  375.  * Inputs: none
  376.  *
  377.  * Output: none
  378.  *************************************************************************/
  379. void InitScreen(void)
  380. {
  381.     _setcursortype(_NOCURSOR);
  382.     puttext(1, 1, 80, 3, title);
  383.     DrawBackground(1, 4, 80, 24);
  384.     puttext(1, 25, 80, 25, menu);
  385. }
  386.  
  387. /*************************************************************************
  388.  * FUNCTION: DEMOEXIT - exits demo by turning cursor back on, setting
  389.  *                                            colors back to normal, clearing the screen, and
  390.  *                                            exiting the program.
  391.  *
  392.  * Inputs: exitState - EXIT_FAILURE or EXIT_SUCCESS
  393.  *
  394.  * Output: none
  395.  *************************************************************************/
  396. void DemoExit(int exitState)
  397. {
  398.   _setcursortype(_NORMALCURSOR);
  399.   textcolor(LIGHTGRAY);
  400.   textbackground(BLACK);
  401.   clrscr();
  402.     exit(exitState);
  403. }
  404.  
  405. /*************************************************************************
  406.  * FUNCTION: DRAWSLIDER - draws the volume slider one line up from the
  407.  *                                                bottom of the window.
  408.  *
  409.  * Inputs: *win - pointer to window structure
  410.  *                 level - scaled volume level (0 - 29)
  411.  *                 state - state to draw window in (NORMAL or HIGHLIGHT).
  412.  *
  413.  * Output: none
  414.  *************************************************************************/
  415. void DrawSlider(WINDOW *win, int level, int state)
  416. {
  417.     COORD loc;
  418.  
  419.     loc.x = (state == HIGHLIGHT)? win->loc.x - 2 : win->loc.x;
  420.     loc.y = (state == HIGHLIGHT)? win->loc.y - 1 : win->loc.y;
  421.  
  422.     if(win->lastChr != 0)
  423.         puttext(loc.x + (win->mixLvl * 29) / 247 + 2, loc.y + win->size.y - 1,
  424.                         loc.x + (win->mixLvl * 29) / 247 + 2, loc.y + win->size.y - 1,
  425.                         (void *)&(win->lastChr));
  426.  
  427.     gettext(loc.x + (level * 29) / 247 + 2, loc.y + win->size.y - 1,
  428.                     loc.x + (level * 29) / 247 + 2, loc.y + win->size.y - 1,
  429.                     (void *)&(win->lastChr));
  430.  
  431.     win->mixLvl = level;
  432.  
  433.     puttext(loc.x + (level * 29) / 247 + 2, loc.y + win->size.y - 1,
  434.                     loc.x + (level * 29) / 247 + 2, loc.y + win->size.y - 1,
  435.                     &(slider[state * 2]));
  436. }
  437.  
  438. /*************************************************************************
  439.  * FUNCTION: DRAWFILELIST - draws the list of file names in the desired
  440.  *                                                    window.
  441.  *
  442.  * Inputs: *win - pointer to window structure
  443.  *                 state - state to draw window in (NORMAL or HIGHLIGHT).
  444.  *
  445.  * Output: none
  446.  *************************************************************************/
  447. void DrawFileList(WINDOW *win, int state)
  448. {
  449.     FILELEMENT *temp;
  450.     int x;
  451.     int y;
  452.  
  453.     temp = win->fileList.start;
  454.     y = win->loc.y + ((state == HIGHLIGHT)? 0 : 1);
  455.     x = win->loc.x + ((state == HIGHLIGHT)? -1 : 1);
  456.  
  457.     if(win->status & VIEWABLE)
  458.         while(temp != win->fileList.stop->next)
  459.         {
  460.             if((temp == win->fileList.current) && (state == HIGHLIGHT))
  461.                 textattr((CYAN << 4) + YELLOW);
  462.             else
  463.                 textattr((BLUE << 4) + ((state == HIGHLIGHT)? LIGHTGRAY : BLACK));
  464.             gotoxy(x, y++);
  465.             switch (temp->status)
  466.             {
  467.                 case PLAYING:
  468.                     cprintf(" %s <─── PLAYING ──── ", temp->filename);
  469.                 break;
  470.                 case PAUSED:
  471.                     cprintf(" %s <─── PAUSED ───── ", temp->filename);
  472.                 break;
  473.                 case STOPPED:
  474.                     cprintf(" %s                   ", temp->filename);
  475.                 break;
  476.             }
  477.             temp = temp->next;
  478.         }
  479.     else
  480.         {
  481.             gotoxy(win->loc.x + win->size.x / 2 - 6, win->loc.y + win->size.y / 2 - 1);
  482.             cputs("No files found");
  483.         }
  484. }
  485.  
  486. /*************************************************************************
  487.  * FUNCTION: DRAWERROR - saves the screen under the error box, draws the
  488.  *                                             box displaying the desired error, waits for a
  489.  *                                             keystroke, and then replaces the saved info.
  490.  *
  491.  * Inputs: *errorStr - string to display in the error box.
  492.  *
  493.  * Output: status - error (not enough memory for save).
  494.  *************************************************************************/
  495. int DrawError(char *errorStr)
  496. {
  497.     int i;
  498.     int strLength;
  499.     int startX;
  500.     char *saved;
  501.  
  502.     strLength = strlen(errorStr);
  503.     startX = (80 - strLength) / 2 - 2;
  504.  
  505.     saved = (char *)malloc((strLength + 6) * 5);
  506.     if(saved == NULL)
  507.     {
  508.         cprintf("\nFatal Error! - unable to allocate memory for error window background save.\n\r");
  509.         return(ERROR);
  510.     }
  511.     // save background
  512.     gettext(startX, 10, startX + strLength + 6, 15, saved);
  513.  
  514.     textcolor(WHITE);
  515.     textbackground(RED);
  516.  
  517.     puttext(startX, 10, startX + 2, 14, errBoxLeft);
  518.     puttext(startX + strLength + 3, 10, startX + strLength + 5, 14, errBoxRight);
  519.     for(i = startX + 3; i < (startX + strLength + 3); i++)
  520.     {
  521.         puttext(i, 10, i, 10, errBoxLine);
  522.         puttext(i, 11, i, 11, errBoxSpace);
  523.         puttext(i, 13, i, 13, errBoxSpace);
  524.         puttext(i, 14, i, 14, errBoxLine);
  525.     }
  526.  
  527.     puttext(startX + 1, 15, startX + strLength / 2 + 4, 15, shadow);
  528.     puttext(startX + strLength / 2 + 5, 15, startX + strLength + 6, 15, shadow);
  529.     puttext(startX + strLength + 6, 11, startX + strLength + 6, 14, shadow);
  530.  
  531.     gotoxy(startX + strLength / 2, 10);
  532.     cputs(" ERROR ");
  533.     gotoxy(startX + 3, 12);
  534.     cputs(errorStr);
  535.  
  536.     // pause
  537.     getch();
  538.     // replace background
  539.     puttext(startX, 10, startX + strLength + 6, 15, saved);
  540.     return(OK);
  541. }
  542.  
  543. /*************************************************************************
  544.  * FUNCTION: DRAWDRVRINFO - saves the screen under the driver info box,
  545.  *                                                    draws the driver info box at requested
  546.  *                                                    location, and then replaces the saved info.
  547.  *
  548.  * Inputs: x,y - upper left corner of driver info box.
  549.  *                 version - SBSIM version.
  550.  *                 drv0 - first driver info.
  551.  *                 drv1 - second driver info.
  552.  *                 drv2 - third driver info.
  553.  *                 drv3 - fourth driver info.
  554.  *                 drv4 - fifth driver info.
  555.  *
  556.  * Output: status - error (not enough memory for save).
  557.  *************************************************************************/
  558. int DrawDrvrInfo(int x, int y, int version, DVRINFO *drv0, DVRINFO *drv1,
  559.                                  DVRINFO *drv2, DVRINFO *drv3, DVRINFO *drv4)
  560. {
  561.     char *saved;
  562.  
  563.     saved = (char *)malloc(73 * 9);
  564.     if(saved == NULL)
  565.         return(ERROR);
  566.  
  567.     // save background
  568.     gettext(x, y, x + 73, y + 9, saved);
  569.  
  570.  
  571.     puttext(x, y, x + 44, y + 1, infoBoxTop);
  572.     puttext(x + 45, y + 1, x + 46, y + 1, shadow);
  573.     puttext(x, y + 2, x + 71, y + 8, infoBox);
  574.     puttext(x + 2, y + 9, x + 37, y + 9, shadow);
  575.     puttext(x + 37, y + 9, x + 73, y + 9, shadow);
  576.     puttext(x + 72, y + 3, x + 73, y + 8, shadow);
  577.  
  578.     textcolor(WHITE);
  579.     textbackground(BLUE);
  580.  
  581.     gotoxy(x + 17, y + 1);
  582.     cprintf("%d.%02d", HIBYTE(version), LOBYTE(version));
  583.     gotoxy(x + 40, y + 1);
  584.     cprintf("%2X", SIMint);
  585.  
  586.     gotoxy(x + 14, y + 4);
  587.     cprintf("%12s│%10s│%10s│%11s│%10s", statStr[drv0->status],
  588.                                                                             statStr[drv1->status],
  589.                                                                             statStr[drv2->status],
  590.                                                                             statStr[drv3->status],
  591.                                                                             statStr[drv4->status]);
  592.     gotoxy(x + 14, y + 5);
  593.     cprintf((drv0->status == LOADED)? "%12Fp│" : "            │", drv0->entry);
  594.     cprintf((drv1->status == LOADED)? "%10Fp│" : "          │", drv1->entry);
  595.     cprintf((drv2->status == LOADED)? "%10Fp│" : "          │", drv2->entry);
  596.     cprintf((drv3->status == LOADED)? "%11Fp│" : "           │", drv3->entry);
  597.     cprintf((drv4->status == LOADED)? "%10Fp" : "          ", drv4->entry);
  598.  
  599.     gotoxy(x + 14, y + 6);
  600.         cprintf(((drv0->status == LOADED) && (drv0->bufLoc != 0))?
  601.                         "%12Fp│" : "            │", drv0->bufLoc);
  602.         cprintf(((drv1->status == LOADED) && (drv1->bufLoc != 0))?
  603.                         "%10Fp│" : "          │", drv1->bufLoc);
  604.         cprintf(((drv2->status == LOADED) && (drv2->bufLoc != 0))?
  605.                         "%10Fp│" : "          │", drv2->bufLoc);
  606.         cprintf(((drv3->status == LOADED) && (drv3->bufLoc != 0))?
  607.                         "%11Fp│" : "           │", drv3->bufLoc);
  608.         cprintf(((drv4->status == LOADED) && (drv4->bufLoc != 0))?
  609.                         "%10Fp" : "          ", drv4->bufLoc);
  610.  
  611.     gotoxy(x + 14, y + 7);
  612.         cprintf(((drv0->status == LOADED) && (drv0->bufSize != 0))?
  613.                         "%11uk│" : "            │", drv0->bufSize);
  614.         cprintf(((drv1->status == LOADED) && (drv1->bufSize != 0))?
  615.                         "%9uk│" : "          │"  , drv1->bufSize);
  616.         cprintf(((drv2->status == LOADED) && (drv2->bufSize != 0))?
  617.                         "%9uk│" : "          │"  , drv2->bufSize);
  618.         cprintf(((drv3->status == LOADED) && (drv3->bufSize != 0))?
  619.                         "%10uk│" : "           │" , drv3->bufSize);
  620.         cprintf(((drv4->status == LOADED) && (drv4->bufSize != 0))?
  621.                         "%9uk" : "          "  , drv4->bufSize);
  622.  
  623.     // pause
  624.     getch();
  625.     // replace background
  626.     puttext(x, y, x + 73, y + 9, saved);
  627.     return(OK);
  628. }
  629.  
  630.